home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacTech 1 to 12
/
MacTech-vol-1-12.toast
/
Source
/
MacTech® Magazine
/
Volume 03 - 1987
/
03.11 Nov 87
/
C string library
/
PStrLib Source
/
PStrFindLS.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1987-10-21
|
417 b
|
20 lines
|
[
TEXT/KAHL
]
/* FILE: PStrFindLS.c
Finds last occurance in both s and set. */
#include "PStrLib.h"
PStrFindLS(s, set)
unsigned char *s, *set; /* Pascal strings */
{
register int i = *s, n;
register unsigned char *setp, *sp = s + i;
while (--i >= 0) {
setp = set;
n = *setp;
while (--n >= 0 && *++setp != *sp);
if (n >= 0) return(sp - s);
--sp;
}
return(0);
} /* Result: 0 if Not Found, else char position */